export function getRGBA(color: string): [number, number, number, number] {
  // Create temporary canvas
  const canvas = document.createElement('canvas');
  canvas.width = 1;
  canvas.height = 1;
  const ctx = canvas.getContext('2d');
  
  if (!ctx) {
    throw new Error('Could not create canvas context');
  }

  // Set fill style to color
  ctx.fillStyle = color;
  ctx.fillRect(0, 0, 1, 1);

  // Get pixel data
  const imageData = ctx.getImageData(0, 0, 1, 1);
  const data = imageData.data;

  // Return RGBA values
  return [data[0], data[1], data[2], data[3]];
}

// Example usage:
// const [r, g, b, a] = getRGBA('#ff0000');
// console.log(r, g, b, a); // 255, 0, 0, 255
